<?php
//viewAssignment_student.php
//provides the student's view of the home page - jlg
//This page cannot be accessed externally, only pulled in by the index.php file.
if (!isset($allow)) { $allow=false; }
require_once("overhead.php");
$error="";
$crumb["link"]="index.php?cid=".$currentCourse."&uid=".$currentUser."&role=".$currentRole;
$crumb["title"]="Course Home";
$breadcrumbs[]=$crumb;
$pageTitle="'".$assignmentData['Name']."'";
$submissionInfoQuery=mysql_query("select Score from submission where AssignmentID=".$assignmentData['ID']." and UserID='".$currentUser."' order by Date desc");
$row=mysql_fetch_assoc($submissionInfoQuery);
printBreadcrumbs();
if (isset($_REQUEST['msg'])) { $error=$_REQUEST['msg']; }
print "<h2>".$assignmentData['Name']."</h2>";
print "<font color='orange'>".$error."</font> <br /><br />";
print "<!--ID: ".$assignmentData['ID']." -->";
print "<strong>Current Score: </strong>".($row["Score"]==null ? "<i>not yet graded</i>" : $row['Score'])."<br />";
print "<strong>Status:</strong> ".$assignmentData['Status']."<br />";
print "<strong>Assignment Description:</strong> <br />";
print str_replace("\n","<br />",$assignmentData['Description']);
print "<br /><br />";
print "<form method='post' action='submitAssignment.php' enctype='multipart/form-data'><strong>Upload Submission:</strong><br /><input type='file' name='submissionFile' />";
//                        <input type='hidden' name='cid' value='".$currentCourse."' />
//						<input type='hidden' name='uid' value='".$currentUser."' />
//						<input type='hidden' name='role' value='".$currentRole."' />
print "<input type='hidden' name='aid' value='".$assignmentData["ID"]."' />";
print "<br />";
print "<input type='submit' value='".($row["Score"]==null ? "Submit!" : "Resumbit!")."' /></form>";

print "<a href='gradeAssignment.php?aid=".$assignmentData['ID']."'>Grade this Assignment.</a>";
?>